<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<jsp:useBean id="player" class="pe.lucene.web.myrating.Player" scope="session"/>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@page import="org.hibernate.Session"%>
<%@page import="pe.lucene.web.myrating.HibernateUtil"%>
<%@page import="org.hibernate.Query"%>
<%@page import="java.util.List"%>
<%@page import="pe.lucene.web.myrating.Rating"%>
<%@page import="java.text.SimpleDateFormat"%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<link rel="stylesheet" type="text/css" href="index.css" />
<link rel="stylesheet" type="text/css" href="table.css" />
<link rel="stylesheet" type="text/css" href="input.css" />
<link rel="stylesheet" type="text/css" href="alert.css" />
<title>Last Game Result</title>
</head>
<body>

              <table>
                  <tr>
                      <td width="240" height="34" background="image/back_main_alert.png" align="center">
                      <span class="screen_alert">
                      
                      <%
                      Session hbSession = HibernateUtil.currentSession();

                      Query query = hbSession.createQuery("from Rating where player = :id order by num desc");
                      query.setParameter("id", player.getId());

                      List list = query.list();

                      if (list.size() == 0) {
                    	  out.println("No Gamge Result yet.");
                      } else {
	                      for (int i=0; i < 1; i++) {
	                          Rating rating = (Rating) list.get(i);
	                          SimpleDateFormat sdf = new SimpleDateFormat("y.MM.dd");
	                          out.println("Last Rating :" + rating.getRating() + "&nbsp;&nbsp;(" + sdf.format(rating.getDate()) + ")");
	                      }
                      }
                      %>
                      
                      </span>
                      </td>
                  </tr>
              </table>

</body>
</html>